// HSS.Forms.DataGridViewCalendarColumn.cs
// ----------------------------------------------------------------------------
// Licensed under the MIT license
// http://www.opensource.org/licenses/mit-license.html
// ----------------------------------------------------------------------------
// HighSpeed-Solutions, LLC
// Copyright (c) 2001-2010
// ----------------------------------------------------------------------------
// File:       DataGridViewCalendarColumn.cs
// Author:     HSS\gbanta
// Created:    08/12/2010
// Modified:   12/04/2010
// ----------------------------------------------------------------------------
namespace HSS.Forms
{
	#region Using Directives
	using System;
	using System.Windows.Forms;
	#endregion

	#region DataGridViewCalendarColumn
	/// <summary>
	/// A DataGridView CalendarColumn
	/// </summary>
	public class DataGridViewCalendarColumn : DataGridViewColumn
	{
		/// <summary>
		/// Default Constructor
		/// </summary>
		public DataGridViewCalendarColumn()
			: base(new DataGridViewCalendarCell())
		{
		}

		/// <summary>
		/// The DataGridViewCell Template for this Column
		/// </summary>
		/// <remarks>
		/// Must be a <see cref="DataGridViewCalendarCell"/>.
		/// </remarks>
		public override DataGridViewCell CellTemplate
		{
			get
			{
				return base.CellTemplate;
			}
			set
			{
				// Ensure that the cell used for the template is a DataGridViewCalendarCell.
				if (value != null &&
					!value.GetType().IsAssignableFrom(typeof(DataGridViewCalendarCell)))
				{
					throw new InvalidCastException("Must be a DataGridViewCalendarCell");
				}
				base.CellTemplate = value;
			}
		}
	}
	#endregion
}